/**
 * Copyright (c) 2016 Lenovo Group
 * All Rights Reserved.
 * 
 * Project Name:lmrp-api
 * Create Time: 2016年1月26日 下午2:36:23
 */
package com.lenovo.lmrp.api.assigntrace;

import java.util.List;
import java.util.stream.Stream;

import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;

import com.lenovo.lmrp.api.model.RestResponse;
import com.lenovo.lmrp.api.model.entity.ActivityFormPO;
import com.lenovo.lmrp.api.model.view.TicketProcessVO;
import com.lenovo.lmrp.api.model.view.WorkFlowSelector;
import com.lenovo.lmrp.api.model.view.WorkFlowVO;

/**
 * @author songyz
 *
 */

@Produces("application/json;charset-utf-8")
@Consumes("application/json;charset-utf-8")
public interface ITraceWorkflow {

	/**
	 * Query list workflow 查询工作流列表
	 * 
	 * @param itsmcode
	 * @return
	 */
	@GET
	@Path("/{itsmcode}/workflows")
	public RestResponse<WorkFlowVO> getWorkFlow(@PathParam("itsmcode") String itsmcode);

	/**
	 * Import the workflow 导入工作流
	 * 
	 * @param itsmcode
	 * @param content
	 * @param bpmnfile
	 * @return
	 */
	@POST
	@Path("/{itsmcode}/workflows")
	public RestResponse<WorkFlowVO> importWorkFlow(@PathParam("itsmcode") String itsmcode,
			@QueryParam("bpmnfile") String bpmnfile);

	/**
	 * enable to disable the workflow 启用禁用工作流
	 * 
	 * @param processid
	 * @param itsmcode
	 * @param status
	 *            1 - 已发布，2 - 已禁用
	 */
	@POST
	@Path("/{itsmcode}/workflows/{processid}")
	public void enableOrDisableWorkFlow(@PathParam("itsmcode") String itsmcode,
			@PathParam("processid") String processid, @QueryParam("status") int status);

	/**
	 * Workflow instance to get the work order 获取工单的工作流实例
	 * 
	 * @param itsmcode
	 * @param ticketid
	 * @return
	 */
	@GET
	@Path("/{itsmcode}/{ticketid}/processinstance")
	public RestResponse<TicketProcessVO> getTicketProcessVO(@PathParam("itsmcode") String itsmcode,
			@PathParam("ticketid") String ticketid);

	/**
	 * Create the workflow selection rules 创建工作流选择规则
	 * 
	 * @param conditions
	 * @param itsmcode
	 * @param processid
	 * @param name
	 */
	@POST
	@Path("/{itsmcode}/workflows/selectors")
	public void createWorkFlowSelector(@PathParam("itsmcode") String itsmcode, @QueryParam("name") String name,
			@QueryParam("conditions") String conditions, @QueryParam("processid") String processid);

	/**
	 * View the list of workflow selection rules 查看工作流选择规则列表
	 * 
	 * @param itsmcode
	 * @return
	 */
	@GET
	@Path("/{itsmcode}/workflows/selectors")
	public RestResponse<List<WorkFlowSelector>> getWorkFlowSeletor(@PathParam("itsmcode") String itsmcode);

	/**
	 * Delete workflow selection rules 删除工作流选择规则
	 * 
	 * @param selectorid
	 * @param itsmcode
	 */
	@DELETE
	@Path("/{itsmcode}/workflows/selectors/{selectorid}")
	public void deleteWorkFlowSelector(@PathParam("itsmcode") String itsmcode,
			@PathParam("selectorid") String selectorid);

	/**
	 * Delete workflow selection rules 修改工作流选择规则
	 * 
	 * @param workFlowSelector
	 * @param selectorid
	 * @param itsmcode
	 */
	@PUT
	@Path("/{itsmcode}/workflows/selectors/{selectorid}")
	public void updateWorkFlowSelector(@PathParam("itsmcode") String itsmcode,
			@PathParam("selectorid") String selectorid, WorkFlowSelector workFlowSelector);

	/**
	 * 查询工作流节点
	 * 
	 * @param itsmcode
	 * @param ticketid
	 * @return
	 */
	@GET
	@Path("/{itsmcode}/{activityid}/activity")
	public RestResponse<ActivityFormPO> getWorkFlowActivity(@PathParam("itsmcode") String itsmcode,
			@PathParam("activityid") String activityid);

}
